<template>
    <section class="section section-shaped section-lg my-0">
        <div class="shape shape-style-1 bg-gradient-default">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="container pt-lg-md">
            <div class="row justify-content-center">
                <div class="col-lg-12">
                    <card type="secondary" shadow
                          header-classes="bg-white pb-5"
                          body-classes="px-lg-5 py-lg-5"
                          class="border-0 mb-3">
                        <div class="col-md-12 justify-content-center">
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('worker-register')" class="col-md-3" type="default">注册</base-button>
                            </div>
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('house-list')" class="col-md-3" type="default">房源列表</base-button>
                            </div>
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('user-list')" class="col-md-3" type="default">用户列表</base-button>
                            </div>
                            <div v-if="role=='admin' || role=='worker'" class="row mb-3 justify-content-center">
                                <base-button @click="open('work-order-manage')" class="col-md-3" type="default">工单管理</base-button>
                            </div>
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('check-audit')" class="col-md-3" type="default">订单审核</base-button>
                            </div>
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('add-new-house')" class="col-md-3" type="default">添加房源</base-button>
                            </div>
                            <div v-if="role=='admin'" class="row mb-3 justify-content-center">
                                <base-button @click="open('contract-manage')" class="col-md-3" type="default">合同管理</base-button>
                            </div>
                        </div>
                    </card>
                </div>
            </div>
        </div>
    </section>
</template>
<script>
import {myInfo,checkCookie} from "../api";
export default {

    data() {
        return{
            role:''
        }
    },
    methods:{
        open(dir){
            this.$router.push({name:dir});
        },
        getRole(){
            checkCookie().then(res=>{
                if(res.code === "1"){
                    this.role = res.data;
                }
            })
        }
    },
    created() {
        this.getRole();
    }
};
</script>
<style>
.contentDiv{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    margin: auto;
}
</style>
